package org.text2diagram.ddl.converter;

@SuppressWarnings("serial")
public class ConverterException extends Exception {

	private Integer lineNo;
	
	public ConverterException(String description) {
		super(description);
	}
	
	public ConverterException(String description, int lineNo) {
		super(description);
		this.lineNo = lineNo;
	}	
	
	public ConverterException(String description, Throwable cause) {
		super(description, cause);
	}
	
	public ConverterException(String description, int lineNo, Throwable cause) {
		super(description, cause);
		this.lineNo = lineNo;
	}

	public String toUserErrorMessage() {
		return "line #" + (lineNo != null ? lineNo : "unknown") + ": " + getMessage();
	}

	public void setLineNo(Integer lineNo) {
		this.lineNo = lineNo;
	}

	public Integer getLineNo() {
		return lineNo;
	}	
	
}
